/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Home.java
 *
 * Created on 16/09/2010, 17:11:05
 */
package NajaTaskClient.interfaces.comum;

import NajaTaskClient.interfaces.gerente.GruposListar;
import NajaTaskClient.interfaces.gerente.projetosListar;
import NajaTaskClient.interfaces.gerente.TarefasListar;
import NajaTaskClient.interfaces.gerente.grupoListar;
import NajaTaskClient.interfaces.gerente.usuariosListar;
import javax.swing.WindowConstants;

/**
 *
 * @author alex.silva
 */
public class aplicacaoJanelaPrincipal extends javax.swing.JFrame {

    Sobre dialogSobre;
    usuarioPreferencias dialogPreferencias;
    usuariosListar dialogListarUsuarios;
    projetosListar dialogListarProjetos;
    TarefasListar dialogListarTarefas;
    grupoListar dialogListarGrupos;

    /** Creates new form Home */
    public aplicacaoJanelaPrincipal() {
        initComponents();
        dialogSobre = new Sobre(this, true);
        dialogPreferencias = new usuarioPreferencias(this, true);
        dialogListarUsuarios = new usuariosListar(this, true);
        dialogListarProjetos = new projetosListar(this, true);
        dialogListarTarefas = new TarefasListar(this, true);
        dialogListarGrupos = new grupoListar(this, true);

        this.setLocationRelativeTo(getRootPane());
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);//fechar ao sair

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel4 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        menuArquivo = new javax.swing.JMenu();
        menuItemSair = new javax.swing.JMenuItem();
        menuFerramentas = new javax.swing.JMenu();
        menuItemOpcoes = new javax.swing.JMenuItem();
        menuFerramentas1 = new javax.swing.JMenu();
        menuItemOpcoes1 = new javax.swing.JMenuItem();
        menuFerramentas2 = new javax.swing.JMenu();
        menuItemProjetos = new javax.swing.JMenuItem();
        menuItemUsuarios = new javax.swing.JMenuItem();
        menuItemGruposUsuarios = new javax.swing.JMenuItem();
        menuItemTarefas = new javax.swing.JMenuItem();
        menuAjuda = new javax.swing.JMenu();
        menuItemSobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Mensagens"));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 682, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 40, Short.MAX_VALUE)
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Tarefas"));

        jLabel1.setText("jLabel1");
        jLabel1.setMaximumSize(new java.awt.Dimension(2147483647, 100));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
        );

        jScrollPane1.setViewportView(jPanel4);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        menuArquivo.setMnemonic('A');
        menuArquivo.setText("Arquivo");

        menuItemSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/exit.png"))); // NOI18N
        menuItemSair.setMnemonic('S');
        menuItemSair.setText("Sair");
        menuItemSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemSairActionPerformed(evt);
            }
        });
        menuArquivo.add(menuItemSair);

        menuBar.add(menuArquivo);

        menuFerramentas.setMnemonic('F');
        menuFerramentas.setText("Ferramentas");

        menuItemOpcoes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/cog.png"))); // NOI18N
        menuItemOpcoes.setMnemonic('P');
        menuItemOpcoes.setText("Preferências");
        menuItemOpcoes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemOpcoesActionPerformed(evt);
            }
        });
        menuFerramentas.add(menuItemOpcoes);

        menuBar.add(menuFerramentas);

        menuFerramentas1.setMnemonic('C');
        menuFerramentas1.setText("Colaborador");

        menuItemOpcoes1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/task.png"))); // NOI18N
        menuItemOpcoes1.setMnemonic('R');
        menuItemOpcoes1.setText("Registrar tarefa");
        menuItemOpcoes1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemOpcoes1ActionPerformed(evt);
            }
        });
        menuFerramentas1.add(menuItemOpcoes1);

        menuBar.add(menuFerramentas1);

        menuFerramentas2.setMnemonic('G');
        menuFerramentas2.setText("Gerencia");
        menuFerramentas2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuFerramentas2ActionPerformed(evt);
            }
        });

        menuItemProjetos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/project.png"))); // NOI18N
        menuItemProjetos.setMnemonic('P');
        menuItemProjetos.setText("Projetos");
        menuItemProjetos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemProjetosActionPerformed(evt);
            }
        });
        menuFerramentas2.add(menuItemProjetos);

        menuItemUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/user.png"))); // NOI18N
        menuItemUsuarios.setMnemonic('U');
        menuItemUsuarios.setText("Usuários");
        menuItemUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemUsuariosActionPerformed(evt);
            }
        });
        menuFerramentas2.add(menuItemUsuarios);

        menuItemGruposUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/group.png"))); // NOI18N
        menuItemGruposUsuarios.setMnemonic('G');
        menuItemGruposUsuarios.setText("Grupos de usuários");
        menuItemGruposUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemGruposUsuariosActionPerformed1(evt);
            }
        });
        menuFerramentas2.add(menuItemGruposUsuarios);

        menuItemTarefas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/task.png"))); // NOI18N
        menuItemTarefas.setMnemonic('T');
        menuItemTarefas.setText("Tarefas");
        menuItemTarefas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemTarefasActionPerformed(evt);
            }
        });
        menuFerramentas2.add(menuItemTarefas);

        menuBar.add(menuFerramentas2);

        menuAjuda.setMnemonic('j');
        menuAjuda.setText("Ajuda");

        menuItemSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/help.png"))); // NOI18N
        menuItemSobre.setMnemonic('S');
        menuItemSobre.setText("Sobre");
        menuItemSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemSobreActionPerformed(evt);
            }
        });
        menuAjuda.add(menuItemSobre);

        menuBar.add(menuAjuda);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemSairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_menuItemSairActionPerformed

    private void menuItemOpcoesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemOpcoesActionPerformed
        this.exibeDialogPreferencias();
    }//GEN-LAST:event_menuItemOpcoesActionPerformed

    private void menuFerramentas2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFerramentas2ActionPerformed
        this.exibeDialogListaUsuarios();
    }//GEN-LAST:event_menuFerramentas2ActionPerformed

    private void menuItemUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemUsuariosActionPerformed
        this.exibeDialogListaUsuarios();
    }//GEN-LAST:event_menuItemUsuariosActionPerformed

    private void menuItemSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemSobreActionPerformed
        this.exibeDialogSobre();
}//GEN-LAST:event_menuItemSobreActionPerformed

    private void menuItemProjetosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemProjetosActionPerformed
        this.exibeDialogListaProjetos();
    }//GEN-LAST:event_menuItemProjetosActionPerformed

    private void menuItemTarefasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemTarefasActionPerformed
        this.exibeDialogListaTarefas();
    }//GEN-LAST:event_menuItemTarefasActionPerformed

    private void menuItemGruposUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemGruposUsuariosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_menuItemGruposUsuariosActionPerformed

    private void menuItemOpcoes1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemOpcoes1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_menuItemOpcoes1ActionPerformed

    private void menuItemGruposUsuariosActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemGruposUsuariosActionPerformed1
        this.exibeDialogListaGrupos();
    }//GEN-LAST:event_menuItemGruposUsuariosActionPerformed1

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new aplicacaoJanelaPrincipal().setVisible(true);
            }
        });
    }

    private void exibeDialogSobre() {
        dialogSobre.setVisible(true);
    }

    private void exibeDialogPreferencias() {
        dialogPreferencias.setVisible(true);
    }

    private void exibeDialogListaUsuarios() {
        dialogListarUsuarios.exibir();
    }
    private void exibeDialogListaGrupos() {
        dialogListarGrupos.exibir();
    }

    private void exibeDialogListaProjetos() {
        dialogListarProjetos.setVisible(true);
    }

    private void exibeDialogListaTarefas() {
        dialogListarTarefas.setVisible(true);
    }

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JMenu menuAjuda;
    private javax.swing.JMenu menuArquivo;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu menuFerramentas;
    private javax.swing.JMenu menuFerramentas1;
    private javax.swing.JMenu menuFerramentas2;
    private javax.swing.JMenuItem menuItemGruposUsuarios;
    private javax.swing.JMenuItem menuItemOpcoes;
    private javax.swing.JMenuItem menuItemOpcoes1;
    private javax.swing.JMenuItem menuItemProjetos;
    private javax.swing.JMenuItem menuItemSair;
    private javax.swing.JMenuItem menuItemSobre;
    private javax.swing.JMenuItem menuItemTarefas;
    private javax.swing.JMenuItem menuItemUsuarios;
    // End of variables declaration//GEN-END:variables
}
